#include "Enqueuer.h"
#include <string>
#include "../utils/Logger.h"


Enqueuer::Enqueuer( const std::string& file,const char key ) {
	this->cola = new Message_Queue<messageQueue>( file, key );
}

Enqueuer::~Enqueuer() {
}

bool Enqueuer::enqueue( const int id, const std::string& text) const {
	messageQueue msg;

	msg.process_id = id;
	strcpy( msg.texto, text.c_str() );

	bool sent = this->cola->write_msg( msg );

	return sent;
}

void Enqueuer::cerrar(){
	this->cola->destroy();
	delete this->cola;
}
